<!--
// +----------------------------------------------------------------------
// | Created by PHPstorm: JRKAdmin框架 [ JRKAdmin ]
// +----------------------------------------------------------------------
// | Copyright (c) 2019~2022 [LuckyHHY] All rights reserved.
// +----------------------------------------------------------------------
// | SiteUrl: http://www.luckyhhy.cn
// +----------------------------------------------------------------------
// | Author: LuckyHhy <jackhhy520@qq.com>
// +----------------------------------------------------------------------
// | Date: 2020/3/4-9:57
// +----------------------------------------------------------------------
// | Description:
// +----------------------------------------------------------------------
*-->

{extend name='public/window' /}


{block name="content"}

<div class="layui-fluid">
    <div class="layui-card">

        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="component-form-group">

                <div class="layui-form-item">
                    <label class="layui-form-label">文章栏目：</label>
                    <div class="layui-input-block">
                        {:widget('common/forms/singleSelect',array('category_id|2|所属分类|title_show|id',$tree,0))}
                    </div>
                </div>

                {:token()}

                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">文章标题：</label>
                    <div class="layui-input-block input-custom-width" style="">
                        <input type="text" name="title" value="" placeholder="请输入文章标题" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入文章标题" autocomplete="off" class="layui-input ">
                    </div>
                </div>

                {:widget('common/forms/Pic',array('image_url|封面图|请上传文章缩略图||上传图片','',700,600))}

                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">关键词：</label>
                    <div class="layui-input-block input-custom-width" style="">
                        <input type="text" name="keywords" value="" placeholder="请输入文章关键词" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入文章关键词" autocomplete="off" class="layui-input ">
                        <p class="help-block">关键词以英文逗号隔开</p>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">文章摘要：</label>
                    <div class="layui-input-block input-custom-width" style="">
                        <textarea name="description" placeholder="请输入文章摘要" lay-verify=""  autocomplete="off" class="layui-textarea "></textarea>
                        <p class="help-block">留空时默认截取内容的前250个字符</p>
                    </div>
                </div>

                <!--Ueditor-->
                {:widget('common/forms/Ueditor',array('content|文章内容|文章内容|420',''))}



                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">是否显示：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="radio" name="is_show" value="1" title="显示" lay-filter=""  checked>
                        <input type="radio" name="is_show" value="0" title="不显示" lay-filter="" >
                        <p class="help-block">不显示将不会在前端页面展示该文章</p>
                    </div>

                    <label class="layui-form-label label-required-next">是否置顶：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="radio" name="is_top" value="1" title="是" lay-filter=""  >
                        <input type="radio" name="is_top" value="0" title="否" lay-filter="" checked >
                    </div>

                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">作者：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="text" name="author" autocomplete="off" class="layui-input" value="{$admin_info['nickname']}">
                    </div>

                    <label class="layui-form-label">点击量：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="text" name="hits" autocomplete="off" class="layui-input" value="0">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">文章来源：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="text" name="source" autocomplete="off" class="layui-input">
                    </div>

                    <label class="layui-form-label">链接地址：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="text" name="url" autocomplete="off" class="layui-input">
                        <p class="help-block">有来源的时候填写来源的地址。</p>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">是否推荐：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="radio" name="is_recommend" value="1" title="推荐" lay-filter=""  >
                        <input type="radio" name="is_recommend" value="0" title="不推荐" lay-filter="" checked >
                    </div>
                    <div class="layui-form-mid layui-word-aux"></div>

                    <label class="layui-form-label">添加时间:</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="text"  value="{:date('Y-m-d H:i:s')}" id="date" lay-verify="datetime" placeholder="YYYY-MM-DD hh:mm:ss" autocomplete="off" class="layui-input">
                    </div>
                </div>

                {:widget('common/forms/submit',array('add','立即提交',2))}

            </form>
        </div>
    </div>
</div>



<script>
    layui.use(['element', 'form', 'jquery','laydate','lucky'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var laydate = layui.laydate;
        var lucky=layui.lucky;

        //时间插件
        laydate.render({
            elem: '#date' //指定元素
            , type: 'datetime'
        });

        form.on('submit(add)', function (data) {
            lucky.FormSubmit("{:url('addArticle')}",data.field,"table_id",1);
            return false;
        });
    })
</script>

{/block}

